home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n16.arc / READBOOT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-27  |  3KB  |  76 lines

  1. PROGRAM readboot;
  2. {*******************************************************************************
  3. *                                                                              *
  4. *     BOOT SECTOR READER, Version 1.1   Copyright (c) 1991 Barry Simon         *
  5. *                        all rights reserved                                   *
  6. *                                                                              *
  7. *            First Published in PC Magazine, September 10, 1991                *
  8. *                                                                              *
  9. *  Requires Turbo Pascal 6.0 to compile (because of use of inline assembler)   *
  10. *                                                                              *
  11. *******************************************************************************}
  12.  
  13.  
  14.  
  15. USES DOS, common;
  16.  
  17. VAR
  18.   j, k : Byte;
  19.   NumSec : LongInt;
  20.  
  21.   PROCEDURE GetDriveNum;          {The program uses the first character
  22.                                      to determine a drive letter; if there
  23.                                      is no parater at all, use default drive}
  24.   VAR
  25.     S : STRING;
  26.   BEGIN
  27.     IF ParamCount > 0 THEN S := ParamStr(1) ELSE GetDir(0, S);
  28.     DriveNum := Ord(Upcase(S[1]))-Ord('A')
  29.   END;
  30.  
  31. BEGIN
  32.   WriteLn('PC Magazine''s Boot Sector Reader');
  33.   WriteLn('  copyright, Barry Simon 1991');
  34.   GetDriveNum;
  35.   WriteLn;
  36.   WriteLn('  Analyzing Drive ', Char(Ord('A')+DriveNum));
  37.   ReadSector(0);
  38.   WITH BootSector DO BEGIN
  39.     SystemID[0] := #8;            {fudge to fix record}
  40.     WriteLn('    The system ID is ', SystemID, '.');
  41.     WriteLn('    The number of bytes per sector is ', BytesPerSector, '.');
  42.     WriteLn('    The number of sectors per cluster is ', SectorsPerCluster, '.');
  43.     WriteLn('    The number of sectors prior to the data area is ', SectorsBeforeData, '.');
  44.     WriteLn('    The number of copies of the FAT is ', NumFAT, '.');
  45.     WriteLn('    The number of file slots in the root directory is ', NumRootDir, '.');
  46.     IF NumSectors = 0 THEN
  47.       WriteLn('    The number of sectors on the disk is ', LongNumSec, '.')
  48.     ELSE WriteLn('    The number of sectors on the disk is ', NumSectors, '.');
  49.     WriteLn('    The DOS media descriptor is ', Hex(MediaDesc), '.');
  50.     WriteLn('    The number of sectors per FAT is ', NumSecPerFAT, '.');
  51.     WriteLn('    The number of sectors per track is ', NumSecPerTrack, '.');
  52.     WriteLn('    The number of heads on the disk is ', NumHeads, '.');
  53.     WriteLn('    The number of hidden sectors is ', NumHidden, '.');
  54.     WriteLn;
  55.   END;                            {with BootSector}
  56.   WriteLn('    The raw data in the first 40 bytes of the boot sector are:');
  57.   Write('      ');
  58.   FOR j := 0 TO 4 DO BEGIN
  59.     FOR k := 0 TO 3 DO BEGIN
  60.       Write(Hex(Sector[4*j+k]), ' ');
  61.     END;
  62.     Write(' ');
  63.   END;
  64.   WriteLn;
  65.   Write('      ');
  66.   FOR j := 0 TO 4 DO BEGIN
  67.     FOR k := 0 TO 3 DO BEGIN
  68.       Write(Hex(Sector[20+4*j+k]), ' ');
  69.     END;
  70.     Write(' ');
  71.   END;
  72.   WriteLn;
  73. END.
  74.  
  75.  
  76.